// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   adddHref.java

package include.nseer_cookie;

import include.nseer_db.nseer_db_backup;
import java.sql.ResultSet;
import javax.servlet.ServletContext;

public class adddHref
{

	private String a;
	private String b;
	private String c;
	private String d;
	private ServletContext dbApplication;

	public adddHref(ServletContext dbApplication)
	{
		a = "";
		b = "";
		c = "";
		d = "";
		this.dbApplication = dbApplication;
	}

	public String adddHref(String unit_db_name, String a)
	{
		this.a = a;
		d = a;
		nseer_db_backup db = new nseer_db_backup(dbApplication);
		try
		{
			int m = 0;
			for (int j = d.indexOf("**"); j != -1; j = d.indexOf("**"))
			{
				d = (new StringBuilder(String.valueOf(d.substring(0, j)))).append(d.substring(j + 2)).toString();
				m++;
			}

			if (m % 2 != 0)
			{
				a = "falsefalse";
			} else
			{
				for (int i = a.indexOf("**"); i != -1; i = a.indexOf("**"))
				{
					b = a.substring(0, i);
					a = a.substring(i + 2);
					i = a.indexOf("**");
					c = a.substring(0, i);
					String sql = (new StringBuilder("select * from document_comment where name='")).append(c).append("'").toString();
					if (db.conn(unit_db_name))
					{
						ResultSet rs = db.executeQuery(sql);
						if (!rs.next())
						{
							String sql1 = (new StringBuilder("insert into document_comment(name) values('")).append(c).append("')").toString();
							db.executeUpdate(sql1);
						}
						db.close();
					}
					a = a.substring(i + 2);
					a = (new StringBuilder(String.valueOf(b))).append("<a href=javascript:winopen(&#39;../../comment/query_list.jsp?readXml=n&keyword_chain=").append(c).append("&#39;)>").append(c).append("</a>").append(a).toString();
				}

			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		return a;
	}
}
